#include "PatientManagerWidget.h"
#include <QApplication>

namespace UserManagementSystem {
PatientManagerWidget::PatientManagerWidget(QWidget *parent)
    : BaseMainWidget(parent)
{
    this->m_mainLayout=new QHBoxLayout(this);

    QString db_path=QApplication::applicationDirPath()+"/res/data.db";

    m_allDataFromDatabase=new UserManagementSystem::UserRepository(db_path);


    m_leftWidget=new UserManagementSystem::LeftWidget(m_allDataFromDatabase);

    m_rightUserWidget=new UserManagementSystem::RightUserWidget(m_allDataFromDatabase);

    InitDefaultLayout();
}

void PatientManagerWidget::InitDefaultLayout()
{
    //添加左侧窗口
    this->m_mainLayout->addWidget(m_leftWidget,2);
    this->m_mainLayout->addWidget(m_rightUserWidget,4);


    //在base窗口的基础上增加这个新的布局(垂直布局中加水平布局)
    this->GetMainLayout()->addLayout(m_mainLayout);

    qDebug()<<"left:"<<m_leftWidget->width()<<"right:"<<m_rightUserWidget->width();



}

}

